package cn.com.yusys.yusp.admin.web.rest;


import cn.com.yusys.yusp.admin.domain.MarketingActivityReportOrganizationPojo;
import cn.com.yusys.yusp.admin.service.MarketingActivityReportOrganizationService;
import cn.com.yusys.yusp.commons.excel.ExcelTaskManager;
import cn.com.yusys.yusp.commons.mapper.QueryModel;
import cn.com.yusys.yusp.commons.web.rest.dto.ResultDto;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/MarketingActivityReportOrganizationResource")
public class MarketingActivityReportOrganizationResource {

    @Resource
    MarketingActivityReportOrganizationService MarketingActivityReportOrganizationService;

    @Resource
    private ExcelTaskManager excelTaskManager;

    private String pojoClassName = MarketingActivityReportOrganizationPojo.class.getName();
    private String exportSql = "getMarketingActivityReportOrganizationInfo";

    @GetMapping("/getMarketingActivityReportOrganizationInfo")
    public ResultDto<List<Map<String, Object>>> getMarketingActivityReportOrganizationInfo(QueryModel queryModel) {
        CustCenterResource.judgeUserJurisdiction(queryModel, false);
        List<Map<String, Object>> list = MarketingActivityReportOrganizationService.getMarketingActivityReportOrganizationInfo(queryModel);
        return new ResultDto<>(list);
    }

    @GetMapping("/exportExcel")
    public ResultDto<String> exportExcel(QueryModel queryModel){
        CustCenterResource.judgeUserJurisdiction(queryModel, false);
        String taskId = excelTaskManager.addExcelExportTask(exportSql, null, queryModel, pojoClassName);
        return new ResultDto<>(taskId);
    }

}
